package com.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.beans.SendMail;

public class SendMailAction extends Action{
	
	
		@Override
		public ActionForward execute(ActionMapping mapping, ActionForm form,
				HttpServletRequest request, HttpServletResponse response)
				throws Exception {
			
			HttpSession session=request.getSession();
			String user_id= "vikas.menon@metagurukul.com";     //session.getAttribute("userid").toString();
			String birthday_user_id="vikasmenon11@gmail.com";
			
			System.out.println("I am in Send mail Action................");
			
			String msg=request.getParameter("mailmessage");
			
			System.out.println("Message is....."+msg);			
			
			SendMail mymail=new SendMail(user_id,birthday_user_id,"BirthDay Wish",msg);
			mymail.send();
			System.out.println("Mail sent Successfully......");
			
			return mapping.findForward("success");
		}
}
